import "reflect-metadata"
import { DataSource } from "typeorm"
import { Department } from "./entity/Department"
import { Employee } from "./entity/Employee"


export const AppDataSource = new DataSource({
    type: "mysql",
    host: "localhost",
    port: 3306,
    username: "root",
    password: "zjhQQsybzd",
    database: "typeorm",
    synchronize: true, //根据Entity自动建表(不建议开)
    logging: false,     //打印sql
    entities: [Department,Employee],  //数据库表对应的Entity 或者可以填 ['./**/entity/*.ts']
    migrations: [],    //修改表结构
    subscribers: [],   //Entity生命周期订阅者, 比如在insert、update、remove 前后加入一些逻辑。
    poolSize: 10,      //数据库连接池中连接的最大数量。
    connectorPackage: 'mysql2',  //驱动包
    extra: {
        authPlugin: 'sha256_password', //驱动包额外配置
    }
})
